knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
library(tidyverse)
library(here)
library(janitor)
library(sf)
library(tmap)
Text here
### Read in the data
ca_counties_sf <- read_sf(here("data", "ca_counties", "CA_Counties_TIGER2016.shp")) %>%
clean_names() %>%
select(county_name = namelsad, land_area = aland)
oil_spills <- read_csv(here("data", "Oil_Spill_Incident_Tracking_[ds394].csv")) %>%
clean_names()
### Check CRS
# ca_counties_sf %>% st_crs() ### EPSG 3857, WGS 84
### Make oil_spill data frame sf
oil_spills_sf <- st_as_sf(oil_spills, coords=c("x","y"), crs = st_crs(ca_counties_sf))
### Don't forget caption
tmap_mode(mode = "view")
tm_shape(ca_counties_sf) +
tm_polygons(alpha = 0.5) +
tm_shape(oil_spills_sf)+
tm_dots(col = "orange")